<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>我的微博列表</h1>
    <div v-for="w in arr">
        <h3>{{w.content}}</h3>
        <div>
            发布于:{{w.created}}
            <a href="javaScript:void(0)" @click="del(w.id)">删除</a>
        </div>
    </div>
</div>
<script src="js/vue.min.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data:{
            arr:[]
        },
        created:function () {
            //查询当前登录用户发布的所有微博
            axios.get("/selectSelf").then(function (response) {
                v.arr = response.data;
            })
        },
        methods:{
           del(id){
               if (confirm("确认删除吗?")){
                   axios.get("/deleteById?id="+id).then(function (response) {
                        alert("删除成功");
                        location.reload();
                   })
               }

           }
        }
    })
</script>
</body>
</html>